<!--
 * @Descripttion:
 * @Version: 1.0
 * @Author: 何志龙
 * @Date: 2023-05-23 17:31:54
 * @LastEditors: 何志龙
 * @LastEditTime: 2023-08-30 14:34:44
-->
<template>
  <div class="organizationDetails">
    <el-table @selection-change="handleSelectionChange" size="small" :data="data11" border style="width: 100%">
      <el-table-column type="selection" width="55"> </el-table-column>
      <el-table-column v-for="(it, in1) in thList" :key="in1" :prop="it.sortField" :label="it.title" align="center">
        <template slot-scope="scope">
          <p v-if="it.title == '与户主关系'" class="scopeItem">
            {{
              scope.row.YHZGX == '156'
              ? '户主'
              : scope.row.YHZGX == '267'
                ? '孙女'
                : scope.row.YHZGX == '28'
                  ? '夫妻'
                  : scope.row.YHZGX == '30'
                    ? '长子'
                    : scope.row.YHZGX == '166'
                      ? '次子'
                      : scope.row.YHZGX == '167'
                        ? '孙子'
                        : scope.row.YHZGX == '168'
                          ? '次女'
                          : scope.row.YHZGX == '169'
                            ? '长女'
                            : '其他亲属'
            }}
          </p>
          <p v-if="it.title == '是否村集体股东'" class="scopeItem">
            {{ scope.row.IFCJTGD ? (scope.row.IFCJTGD == '5' ? '是' : '否') : '' }}
          </p>
          <p v-else-if="it.title == '是否机关事业单位'" class="scopeItem">
            {{ scope.row.IFJGSYDW ? (scope.row.IFJGSYDW == '5' ? '是' : '否') : '' }}
          </p>
          <p v-else-if="it.title == '婚姻状况'" class="scopeItem">
            {{ scope.row.HYZK ? (scope.row.HYZK == '7' ? '已婚' : scope.row.HYZK == '8' ? '未婚' : '离婚') : '' }}
          </p>
          <p v-else-if="it.title == '是否有不动产'" class="scopeItem">
            {{ scope.row.IFBDC ? (scope.row.IFBDC == '5' ? '是' : '否') : '' }}
          </p>
          <p v-else-if="it.title == '性别'" class="scopeItem">{{ scope.row.SEX == '3' ? '男' : '女' }}</p>
          <p v-else-if="it.title != '与户主关系'">{{ scope.row[it.sortField] }}</p>
        </template>
      </el-table-column>
    </el-table>
    <van-button v-show="Isshowbutton" type="info" size="small" style="position: absolute; top: -45px; left: 330px"
      @click="handleAddusers('添加')">添加</van-button>
    <van-button v-show="Isshowbutton" type="info" size="small" style="position: absolute; top: -45px; left: 285px"
      @click="handleAddusers('修改')">修改</van-button>
    <van-button v-show="Isshowbutton" type="info" size="small" style="position: absolute; top: -45px; left: 240px"
      @click="handleAddusers('删除')">删除</van-button>
    <van-dialog v-model="isShow" :title="dialogTitle" show-cancel-button @confirm="saveBtn" @cancel="cancelBtn">
      <van-form validate-first>
        <div style="padding: 10px">
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <van-field v-model="tableFrom[0].XM" :required="true" label="姓名" placeholder="请输入姓名" />
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <van-field name="validator" v-model="tableFrom[0].NL" :required="true" label="年龄" placeholder="请输入年龄" />
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <!-- <van-field name="validator" v-model="tableFrom.YHZGX" label="与户主关系" placeholder /> -->
            <van-field readonly clickable name="picker" @click="ENUM.YHZGX = true"
              :value="tableFrom[0].YHZGX | inUseName(ENUM.YHZGXARR)" :required="true" label="与户主关系"
              placeholder="请选择与户主关系" />
            <van-popup v-model="ENUM.YHZGX" position="bottom" get-container="#popup">
              <van-picker show-toolbar :columns="ENUM.YHZGXARR" value-key="DICNAME" @confirm="onConfirm14"
                @cancel="ENUM.YHZGX = false" />
            </van-popup>
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <!-- <van-field name="validator" v-model="tableFrom.YHZGX" label="与户主关系" placeholder /> -->
            <van-field readonly clickable name="picker" @click="ENUM.XB1 = true"
              :value="tableFrom[0].SEX | inUseName(ENUM.XBARR)" :required="true" label="性别" placeholder="请选择性别" />
            <van-popup v-model="ENUM.XB1" position="bottom" get-container="#popup">
              <van-picker show-toolbar :columns="ENUM.XBARR" value-key="DICNAME" @confirm="onConfirm5"
                @cancel="ENUM.XB1 = false" />
            </van-popup>
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <!-- <van-field name="validator" v-model="tableFrom.YHZGX" label="与户主关系" placeholder /> -->
            <van-field readonly clickable name="picker" @click="ENUM.CJT = true"
              :value="tableFrom[0].IFCJTGD | inUseName(ENUM.CJTARR)" label="是否村集体股东" placeholder="选择是否村集体股东" />
            <van-popup v-model="ENUM.CJT" position="bottom" get-container="#popup">
              <van-picker show-toolbar :columns="ENUM.CJTARR" value-key="DICNAME" @confirm="onConfirm15"
                @cancel="ENUM.CJT = false" />
            </van-popup>
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <!-- <van-field name="validator" v-model="tableFrom.YHZGX" label="与户主关系" placeholder /> -->
            <van-field readonly clickable name="picker" @click="ENUM.IFBDC = true"
              :value="tableFrom[0].IFBDC | inUseName(ENUM.IFBDCARR)" label="是否有不动产" placeholder="请选择是否有不动产" />
            <van-popup v-model="ENUM.IFBDC" position="bottom" get-container="#popup">
              <van-picker show-toolbar :columns="ENUM.IFBDCARR" value-key="DICNAME" @confirm="onConfirm16"
                @cancel="ENUM.IFBDC = false" />
            </van-popup>
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <!-- <van-field name="validator" v-model="tableFrom.YHZGX" label="与户主关系" placeholder /> -->
            <van-field readonly clickable name="picker" @click="ENUM.IFJGSYDW = true"
              :value="tableFrom[0].IFJGSYDW | inUseName(ENUM.IFJGSYDWARR)" label="是否机关事业单位" placeholder="请选择是否机关事业单位" />
            <van-popup v-model="ENUM.IFJGSYDW" position="bottom" get-container="#popup">
              <van-picker show-toolbar :columns="ENUM.IFJGSYDWARR" value-key="DICNAME" @confirm="onConfirm17"
                @cancel="ENUM.IFJGSYDW = false" />
            </van-popup>
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <!-- <van-field name="validator" v-model="tableFrom.YHZGX" label="与户主关系" placeholder /> -->
            <van-field readonly clickable name="picker" :value="tableFrom[0].HYZK | inUseName(ENUM.HYZKARR)"
              :required="true" @click="ENUM.HYZK = true" label="婚姻状况" placeholder="请选择婚姻状况" />
            <van-popup v-model="ENUM.HYZK" position="bottom" get-container="#popup">
              <van-picker show-toolbar :columns="ENUM.HYZKARR" value-key="DICNAME" @confirm="onConfirm18"
                @cancel="ENUM.HYZK = false" />
            </van-popup>
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <van-field name="validator" :rules="[{ validator, message: '请输入正确身份证号码' }]" :required="true"
              v-model="tableFrom[0].SFZ" label="身份证号" placeholder="请输入身份证号" />
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <van-field name="validator" v-model="tableFrom[0].HKSZD" label="户口所在地" placeholder="请输入户口所在地" />
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <van-field name="validator" v-model="tableFrom[0].BDCBH" label="不动产编号" placeholder="请输入不动产编号" />
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <van-field readonly clickable name="picker" @click="showPickerq = true" v-model="tableFrom[0].SWSJ"
              label="死亡时间" placeholder="请选择死亡时间" />
            <van-popup v-model="showPickerq" position="bottom">
              <van-datetime-picker v-model="currentDate" type="date" title="选择年月日" @cancel="showPickerq = false"
                @confirm="onConfirm19" :min-date="minDate" :max-date="maxDate" /></van-popup>
          </div>
          <div
            style="display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #d2d2d2; color: black">
            <!-- <span style="color: #ff0000">*</span> -->
            <van-field readonly clickable name="picker" @click="showPickerq1 = true" v-model="tableFrom[0].HHSJ"
              label="火化时间" placeholder="请选择火化时间" />
            <van-popup v-model="showPickerq1" position="bottom">
              <van-datetime-picker v-model="currentDate" type="date" title="选择年月日" @cancel="showPickerq1 = false"
                @confirm="onConfirm20" :min-date="minDate" :max-date="maxDate" /></van-popup>
          </div>
        </div>
      </van-form>
    </van-dialog>
  </div>
</template>

<script>
import {
  FileServerProxy
} from '@/utils/api'
import { GSA_Search } from '../../../common/commonApi'
export default {
  filters: {
    inUseName: function (msg, data) {
      let name = ''
      data.forEach((item) => {
        if (item.DICID == msg) {
          name = item.DICNAME
        }
      })
      return name
    }
  },
  data() {
    return {
      //建房信息存储
      value: '',
      Isshowbutton: true,
      show20: false,
      tableData11: [],
      weiGaiData: [],
      multipleSelection111: [],
      formData19: {
        CLMC: '',
        YJFYJ: '',
        FS: '',
        BZ: ''
      },
      tablecoums11: [
        {
          name: '材料名称',
          prop: 'CLMC'
        },
        {
          name: '原件/复印件',
          prop: 'YJFYJ'
        },
        {
          name: '份数',
          prop: 'FS'
        },
        {
          name: '备注',
          prop: 'BZ'
        }
      ],
      isShow111: false,
      text4: {
        title: '提示',
        message: '是否确认删除?',
        btn: {
          okText: '确定',
          cancelText: '取消'
        }
      },
      showSelectTime: false,
      showIS: false,
      file: [
        {
          name: '身份证正面照片（浙里办）',
          groupGuid: '19902700-f952-4561-a338-5590056dab65',
          fileList: []
        },
        {
          name: '身份证反面照片（浙里办）',
          groupGuid: 'd26fd8fd-0d8a-46ec-af9f-2341ba78fb58',
          fileList: []
        },
        {
          name: '农村宅基地使用承诺书',
          groupGuid: '188027de-4ba9-4218-bcb1-03bf764293fa',
          fileList: []
        },
        {
          name: '代办人手持照片',
          groupGuid: '85f99afa-f0c4-4064-b7a3-84eb417bc43a',
          fileList: []
        }
      ],
      shoulm1: false,
      text: {
        title: '温馨提示',
        message: '该案卷将终止审批并退件到农户，是否继续？',
        btn: {
          okText: '确定',
          cancelText: '取消'
        }
      },
      IF_GZS: '',
      DHLY1: {
        DHLY: '',
        OPINION: '',
        SIGNERNAME: '',
        SIGNDATE: '',
        TODATA_GUID: ''
      },
      DHLY: '',
      shoulm2: false,
      showPickerq: false,
      showPickerq1: false,
      currentDate: new Date(),
      minDate: new Date(1970, 0, 1),
      maxDate: new Date(2089, 12, 1),
      isShow: false,
      isshowUsers: false,
      ShowData: true,
      YDLX_NYD: '',
      multipleSelection1: [],
      IFCJTGD: '',
      IFBDC: '',
      tableData1: [{ HOUSEAPPLICANT: '111', CERTIFICATECODE: '222', YHZGX: '333', SFZH: '333', NL: '', HKSZD: '111', SEX: '3' }],
      dialogTitle: '',
      tableFrom: [
        {
          XM: '',
          SFZ: '',
          NL: '',
          SFZH: '',
          HKSZD: '',
          YHZGX: '',
          SEX: '',
          IFCJTGD: '',
          IFCJTGD: '',
          IFBDC: '',
          BDCBH: '',
          IFJGSYDW: '',
          SWSJ: '',
          HHSJ: '',
          HYZK: ''
        }
      ],
      //用于必填项控制
      newObj: {
        ZJDMJ: '',
        JZMJ: '',
        XZJDCZQK: '',
        LANDTYPE: '',
        BUILDSTOREY: '',
        SEWAGEDISPOSAL: '',
        STRUCTURETYPE: '',
        ZGSHYJ: '',
        QSZSH: '',
        F_IFSILINGYIJIAN: '',
        // SPLX: ''
      },
      SPLX: '',
      isShow2: false, //用于是否展示其他内容输入
      isShow3: false, //用于是否展示农用地
      JFData: {
        PKID: 32011,
        TASK_CAUTIONLIGHT: '1',
        IF_WFH_WG: 644,
        ROW_GUID: '',
        WDGD: '',
        IF_JXBL: '',
        CERTIFICATECODE: '',
        HOUSEAREA: '',
        HOUSETYPE: '',
        IF_JXBL_SM: '',
        HOUSEAPPLICANT: '',
        APPLYPHONE: '',
        APPLYTYPE: '',
        APPLYTIME: '2022-07-26 22:17:32',
        BUILDTYPE: 12,
        BUILDREASON: '64',
        LANDTYPE: 15,
        STRUCTURETYPE: 42,
        ADDRESS: '',
        HOMESTEADAREA: 11,
        BUILDAREA: 1,
        BUILDSTOREY: '二层',
        BUILDHEIGHT: 1,
        HOUSEFLOORAREA: 1,
        APPLYSTATE: '',
        CREATETIME: '',
        VERSION: '',
        HOUSEID: '',
        PERSONNAME: '',
        IDCARD: '',
        PERMANENTADDR: '',
        HOLDERISCANCEL: '',
        ISDEATH: '',
        ISSUPPORT: '',
        AGE: '',
        ISDISEASE: '',
        ISSHAREHOLDER: '',
        OFFICEWORK: '',
        ADJACENTOPINION: '',
        WALLCOLOR: '1',
        CONSTRUCTIONTYPE: '',
        MASONRYTYPE: '',
        SEWAGEDISPOSAL: '',
        ISHIGHRISKAREA: '',
        CUTSLOPEBUILDING: '',
        PERMANENTADDRESS: '',
        CONSTRUCITONADDRESS: '衢州市江山市双塔街道陈村村集体',
        ORIGINALAREA: '',
        ISDISPOSAL: '',
        DISPOSALMETHOD: '',
        ORICERTIFICATECODE: '',
        MPH: '',
        AREACOVERED: '',
        SEX: 3,
        SQLY: '',
        BZ: '1',
        DZ: '1',
        NZ: '1',
        IF_LJF: 6,
        XZ: '1',
        CUNJIID: '',
        CUNJIMC: '',
        SQFS: 35,
        DBRXM: '',
        DBRSFZH: '',
        DBRSJH: '',
        S: '330800000000',
        X: '330881000000',
        ZGSHYJ: '11111',
        JSXZ: '',
        ZJDMJ: 11,
        JZMJ: 1,
        ZJDDH: '',
        QSZSH: '1',
        XZJDCZQK: 38,
        F_IFSILINGYIJIAN: '',
        ZJZGSHJG: '',
        YJ: '',
        ZJZGSHYJFZR: '',
        ZJZGSH: '',
        GHYJJBR: '',
        GHJBRJG: '',
        GHFZR: '',
        NFFZR: '',
        NFJBR: '',
        NFJBRJG: '',
        NFFZRJG: '',
        ZFSH: '',
        CS: '',
        TOWN: '330881001000',
        NHID: '51608',
        CWID: '7991',
        ZJID: '',
        CWMC: '',
        ZJMC: '',
        ZGSJ: '',
        ZGSHR: '2022-07-29 10:43:27',
        ZJZGSHR: '',
        ZJZGSHR2: '',
        ZJZGSHSJ: '',
        ZJZGSHSJ2: '',
        ZJGHSHR: '',
        ZJGHSHR2: '',
        ZJGHSHSJ: '',
        ZJNFSHSJ: '',
        ZJNFSHSJ2: '',
        ZJNFSHR: '',
        ZJNFSHR2: '',
        ZJZFSHR: '',
        ZJZFSHSJ: '',
        CWSHR: '',
        ZJGHSHSJ2: '',
        CUN: '',
        IF_TDZ: '',
        IF_DXS: '',
        WZYY: '',
        SCITY: '',
        XCITY: '',
        VILLAGE: '',
        SSZZ: '',
        HQYJ: '',
        HQR: '',
        HQSJ: '',
        GHFWLX: '',
        TDQX: '',
        FAMILYHOUSEID: '',
        SBZT: '',
        FYSQR: '',
        FYSQRID: '',
        FYSQSJ: '',
        JCYXSQR: '',
        JCYXSQRID: '',
        JCYXSQSJ: '',
        YCLMSQR: '',
        YCLMSQRID: '',
        YCLMSQSJ: '',
        JGYSSQR: '',
        JGYSSQRID: '',
        JGYSSQSJ: '',
        JGYSJZSJ: '',
        SFXSFB: '',
        XZJDCZQK_BL: '',
        XZJDCZQK_QT: '',
        YDLX_NYD: '',
        YDLX_NYD_QT: '',
        NZJDJFDZ: '',
        XCJSGHXKZH: '',
        NCZJDPZSH: '',
        SQR: '',
        DBRID: '',
        GJID: '',
        ISZRSGUID: '',
        SUNSHINEDIST: '1',
        JGRQ: '',
        BUILDREASON_QT: '',
        F_IFSFSLYJ: 5,
        IFGJ: '',
        OLD_GJ: '',
        BUILDTYPE_DICNAME: '',
        BUILDREASON_DICNAME: '',
        BUILDSTOREY_DICNAME: '',
        IF_LJF_DICNAME: '',
        SQFS_DICNAME: '',
        VILLAGE_CITYNAME: '',
        SSZZ_CITYNAME: '',
        XCITY_CITYNAME: '',
        SCITY_CITYNAME: '',
        CUN_CITYNAME: '',
        TOWN_CITYNAME: '',
        X_CITYNAME: '',
        S_CITYNAME: '',
        YDLX_NYD_DICNAME: '',
        SPLX: '',
        eca_RowState: 'modified'
      },
      HYZK: '',
      //联建人
      ljr: {},
      XB: '',
      //处置情况
      XZJDCZQK: '',
      //建房类型
      buildtype: '',
      //用地类型
      landtype: '',
      //建筑层数
      buildstorey: '',
      //结构类型
      structuretype: '',
      //污水处理
      sewagedisposal: '',
      adjacentopinion: '',
      isShow4: false,
      activeNames: ['0'],
      isShow10: false,
      isread: false,
      active: 'first',
      active1: 'first',
      sexName: '',
      IFJGSYDW: '',
      ENUM: {
        XB: false,
        SPLX: false,
        SPLXArr: [],
        TKBMARR11: [
          {
            DICID: '5',
            DICNAME: '是'
          },
          {
            DICID: '6',
            DICNAME: '否'
          }
        ],
        XB1: false,
        IFBDC: false,
        HYZK: false,
        DHLY: false,
        DHLYARR: [],
        HYZKARR: [],
        IFBDCARR: [],
        IF_WFH_WG: false,
        IF_WFH_WGArr: [],
        IFJGSYDW: false,
        IFJGSYDWARR: [],
        IF_JXBLArr: [],
        IF_JXBL: false,
        CJT: false,
        XBARR: [],
        CJTARR: [],
        SF: false,
        SF1: false,
        SF2: false,
        //处置情况
        SFARR: [],
        //建房类型
        NYD: false,
        NYDARR: [],
        //地类
        JFLX: false,
        JFLXARR: [],
        //建筑层数
        YDLX: false,
        YDLXARR: [],
        //污水处理
        JGLX: false,
        JGLXARR: [],
        //建筑结构
        WSCLFS: false,
        WSCLFSARR: [],
        //邻居同意否
        TKBM: false,
        TKBMARR: [],
        CHBM: false,
        CHBMARR: [],
        SFSJSLYJ: false,
        SFSJSLYJARR: [],
        //与户主关系
        YHZGX: false,
        TKBMIF_GZS: false,
        YHZGXARR: [],
        NYDARR: []
      },
      YHZGX: '',
      IF_WFH_WG: '',
      F_IFSILINGYIJIAN: '',
      FormXB: '',
      multipleSelection10: [],
      keys: [],
      values: [],
      zgData: [
        {
          title: '户籍家庭成员信息',
          tableData: [],
          tablecoums: [
            {
              name: '姓名',
              prop: 'FAMILYNAME'
            },
            {
              name: '年龄',
              prop: 'FAMILYAGE'
            },
            {
              name: '与户主关系',
              prop: 'HOUSERELATIONSHIP'
            },
            {
              name: '身份证号',
              prop: 'FAMILYIDCARD'
            },
            {
              name: '性别',
              prop: 'FAMILYSEX'
            },
            {
              name: '出生日期',
              prop: 'HOUSEBIRTHDAY'
            },
            {
              name: '是否村集体股东',
              prop: 'IFCJTGD'
            },
            {
              name: '婚姻状况',
              prop: 'HOUSEMERRIAGE'
            },
            {
              name: '是否有不动产',
              prop: 'IFBDC'
            },
            {
              name: '是否机关事业单位',
              prop: 'YHZGX'
            },
            {
              name: '不动产编号',
              prop: 'BDCBH'
            },
            {
              name: '死亡时间',
              prop: 'SWSJ'
            },
            {
              name: '火化时间',
              prop: 'HHSJ'
            }
          ]
        },
        {
          title: '村集体股东信息',
          tableData: [],
          tablecoums: [
            {
              name: '姓名',
              prop: 'name'
            },
            {
              name: '性别',
              prop: 'sex'
            },
            {
              name: '身份证号',
              prop: 'SFZH'
            },
            {
              name: '与户主关系',
              prop: 'houserelationship'
            },
            {
              name: '是否村集体股东',
              prop: 'iscollective'
            },
            {
              name: '村集体股东描述',
              prop: 'collectivediscripe'
            }
          ]
        },
        {
          title: '婚姻信息',
          tableData: [],
          tablecoums: [
            {
              name: '姓名',
              prop: 'FAMILYNAME'
            },
            {
              name: '婚姻状况',
              prop: 'MERRIAGECONDITION'
            },
            {
              name: '婚姻描述',
              prop: 'MERRIAGEDISCRIBE'
            }
          ]
        },
        {
          title: '不动产权信息',
          tableData: [],
          tablecoums: [
            {
              name: '姓名',
              prop: 'FAMILYNAME'
            },
            {
              name: '是否有不动产',
              prop: 'ISREALESTATE'
            },
            {
              name: '不动产编号',
              prop: 'REALESTATENUMBER'
            },
            {
              name: '不动产权证描述',
              prop: 'REALESTATEDISCRIBE'
            }
          ]
        },
        {
          title: '机关事业单位',
          tableData: [],
          tablecoums: [
            {
              name: '姓名',
              prop: 'FAMILYNAME'
            },
            {
              name: '是否机关事业单位',
              prop: 'ISORGANS'
            },
            {
              name: '机关事业单位描述',
              prop: 'ORGANSDISCRIBE'
            }
          ]
        },
        {
          title: '火化信息',
          tableData: [],
          tablecoums: [
            {
              name: '姓名',
              prop: 'XM'
            },
            {
              name: '民族',
              prop: 'MZ'
            },
            {
              name: '地址',
              prop: 'DZ'
            },
            {
              name: '死亡时间',
              prop: 'SWSJ'
            },
            {
              name: '火化时间',
              prop: 'HHSJ'
            }
          ]
        },
        {
          title: '家庭成员信息',
          tableData: [],
          tablecoums: [
            {
              name: '姓名',
              prop: 'XM',
              isread: true
            },
            {
              name: '年龄',
              prop: 'NL',
              isread: true
            },
            {
              name: '与户主关系',
              prop: 'YHZGX',
              isread: true
            },
            {
              name: '身份证号',
              prop: 'SFZ',
              isread: true
            },
            {
              name: '户口所在地',
              prop: 'HKSZD',
              isread: true
            },
            {
              name: '性别',
              prop: 'SEX',
              isread: true
            },
            {
              name: '是否村集体股东',
              prop: 'IFCJTGD'
            },
            {
              name: '婚姻状况',
              prop: 'HYZK',
              isread: true
            },
            {
              name: '是否有不动产',
              prop: 'IFBDC'
            },
            {
              name: '是否机关事业单位',
              prop: 'YHZGX'
            },
            {
              name: '不动产编号',
              prop: 'BDCBH'
            },
            {
              name: '死亡时间',
              prop: 'SWSJ'
            },
            {
              name: '火化时间',
              prop: 'HHSJ'
            }
          ]
        }
      ],
      //当前行数据
      rowData: {},
      groupGuids: [],
      isADD11: false,
      newData11: {},
      IsAddData: "",
    }
  },
  props: {
    data11: Array,
    thList: Array,
    Isshowbutton: Boolean,
    mainrowGuid: String,
    IsFarmData: Boolean
  },
  computed: {},
  watch: {},
  created() { },
  mounted() {
    let emitData = [
      'a8e5782d-9a59-48e4-b35b-654b9bb667ca',
      '2c478392-9c1b-40da-b941-41e4b8c9d6d3',
      'db35edee-88e0-4fae-b14a-868ed4beb1d9',
      'd2ec96d4-b5bc-404a-a9f1-34db915c694b',
      'a892e0f4-5fd6-42b4-b6c2-6e1fc5ebb5dc',
      'f7f359ad-369c-4bf4-892c-294dceb5edef',
      'b65d1943-66f4-49b1-b759-cd9f079dc0d3',
      '86d6eb80-8bcb-49f6-b5c3-462ac1ae585d',
      '8670f99d-6127-45ec-be7c-8d76303bf38c',
      '173cb6af-d07c-4143-8169-8436af10264d',
      '67176c5f-ebad-4f7b-9cb4-d2a926f511cf',
      '52215e71-341a-452b-8823-a8d4aae058ab',
      'c3c0ecf0-2d89-4394-9f51-0fbb5de4a322',
      '86d6eb80-8bcb-49f6-b5c3-462ac1ae585d',
      'd6aebfde-a9d7-441b-9f10-eb4c6651ea8b',
      'd47fc1d9-c756-4a46-8259-7e65c82f26ba'
    ]
    //获取字典值 性别
    this.getEnum(emitData)
    if (this.IsFarmData) {
      //先查询是否有家庭成员信息(踏勘)
      this.getLianJianRenData();
    }

  },
  methods: {
    //获取家庭成员信息
    async getLianJianRenData() {
      this.content = [];
      let data = [
        {
          field: 'TO_ROW_GUID',
          value: this.mainrowGuid
        }
      ]
      const res = await GSA_Search('8d72f08a-7992-466a-81d0-b072408fea56', data)
      debugger
      if (res.Data && res.Data.length > 0) {
        this.IsAddData = 'edit';
        this.data11 = res.Data;
      } else {
        //没有数据 通过接口查询赋值
        this.getFarmInfo();
        this.IsAddData = 'add';
      }
      // this.content = res.Data
    },
    //获取数据
    getFarmInfo: async function () {
      debugger
      let me = this;
      this.data11 = [];
      let params = {
        accessCode: '688bd3883572440a859dfd8ba9194e7b',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '',
        params: {
          dataguid: '0d3eacb5-d60b-46e4-a62e-9cf914ffca4a',
          searchObject: JSON.stringify([
            { field: 'TO_ROW_GUID', value: this.mainrowGuid, operator: '=' },
          ])
        }
      }
      const res = await FileServerProxy(params)
      if (JSON.parse(res.data.data) && JSON.parse(res.data.data).Data.length > 0) {
        this.data11 = JSON.parse(res.data.data).Data;
        this.data11.forEach((items) => {
          items.PKID = "";
          items.ROW_GUID = "";
          items.TYPE = 2;
        })
        // this.zgData.forEach((item => {
        //   if (item.title == '家庭成员信息') {
        //     item.tableData = JSON.parse(res.data.data).Data;
        //   }
        // }))
      }
    },
    //获取家庭成员信息
    getFarmInfoList: async function () {
      this.data11 = [];
      let params = {
        accessCode: '688bd3883572440a859dfd8ba9194e7b',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '',
        params: {
          dataguid: '8d72f08a-7992-466a-81d0-b072408fea56',
          searchObject: JSON.stringify([
            { field: 'TO_ROW_GUID', value: this.mainrowGuid, operator: '=' },
          ])
        }
      }
      const res = await FileServerProxy(params)
      if (JSON.parse(res.data.data) && JSON.parse(res.data.data).Data.length > 0) {
        this.data11 = JSON.parse(res.data.data).Data;
      }
    },
    //删除家庭成员
    deleteFarmlyData: async function () {
      debugger
      console.log(this.tableFrom[0]);
      var  p={
         PKID:this.tableFrom[0].PKID,
         ROW_GUID:this.tableFrom[0].ROW_GUID
      }
      let params = {
        accessCode: '434b72c2945518775ee423268b0b8121',
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '',
        params: {
          dataguid: '8d72f08a-7992-466a-81d0-b072408fea56',
          strParams: JSON.stringify([p])
        }
      }
      const res = await FileServerProxy(params);
      if(res.data&&res.data.data){
        this.$toast.success('删除成功!');
        this.getFarmInfoList();
      }
    },
    //需要增加新增和删除还有修改
    validator(val) {
      var idcardReg = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/
      return idcardReg.test(val)
    },
    handleAddusers(name) {
      if (name == '添加') {
        this.isShow = true
        this.dialogTitle = '新增'
        this.YHZGX = ''
        this.IFCJTGD = ''
        this.IFBDC = ''
        this.IFJGSYDW = ''
        this.currentDate = ''
        this.HYZK = ''
        this.FormXB = ''
        this.tableFrom = [
          {
            XM: '',
            SFZ: '',
            NL: '',
            SFZH: '',
            HKSZD: '',
            YHZGX: '',
            SEX: '',
            IFCJTGD: '',
            IFCJTGD: '',
            IFBDC: '',
            BDCBH: '',
            IFJGSYDW: '',
            SWSJ: '',
            HHSJ: '',
            HYZK: ''
          }
        ]
      } else if (name == '删除') {
        this.$confirm({
          title: '提示',
          message: '确认删吗？',
          btn: {
            okText: '确定',
            cancelText: '取消'
          }
        })
          .then(() => {
            // do something
            if (this.multipleSelection10.length == 0) {
              this.$toast.fail('请选择一行数据')
            } else if (this.multipleSelection10.length > 1) {
              this.$toast.fail('只能选择选择一行数据')
            }else{
              this.tableFrom = this.multipleSelection10
              this.deleteFarmlyData()
            }

          })
          .catch(() => {
            console.log('no')
          })
      } else {
        console.log(this.multipleSelection10, 'this.multipleSelection10')
        if (this.multipleSelection10.length == 0) {
          this.$toast.fail('请选择一行数据')
        } else if (this.multipleSelection10.length > 1) {
          this.$toast.fail('只能选择选择一行数据')
        } else {
          this.isShow = true
          this.dialogTitle = '修改'
          this.tableFrom = this.multipleSelection10
          this.YHZGX = this.multipleSelection10[0].YHZGX
          this.FormXB = this.multipleSelection10[0].SEX
          this.IFBDC = this.multipleSelection10[0].IFBDC
          this.IFJGSYDW = this.multipleSelection10[0].IFJGSYDW
          this.currentDate = this.multipleSelection10[0].currentDate
          this.HYZK = this.multipleSelection10[0].HYZK
        }
      }
    },
    cancelBtn() {
      this.isShow = false
    },
    // 格式化日期
    dateFormat(val) {
      let year = val.getFullYear()
      let month = val.getMonth() + 1
      let day = val.getDate()
      let hour = val.getHours()
      let minute = val.getMinutes()
      if (month >= 1 && month <= 9) {
        month = `0${month}`
      }
      if (day >= 1 && day <= 9) {
        day = `0${day}`
      }
      if (hour >= 0 && hour <= 9) {
        hour = `0${hour}`
      }
      if (minute >= 0 && minute <= 9) {
        minute = `0${minute}`
      }
      let time = `${year}-${month}-${day}`
      return time
    },
    //获取界面所需字典值
    getEnum(emitData = []) {
      emitData.forEach(async (item) => {
        console.log(this)
        let params = {
          accessCode: '688bd3883572440a859dfd8ba9194e7b',
          cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
          params: {
            dataguid: item,
            searchObject: JSON.stringify([]),
            token: window.localStorage.getItem('token')
          }
        }
        const res = await FileServerProxy(params)
        let newData = JSON.parse(res.data.data).Data
        switch (item) {
          case 'a8e5782d-9a59-48e4-b35b-654b9bb667ca':
            this.ENUM.XBARR = newData
            this.ENUM.XBARR.forEach((element) => {
              if (element.DICID == this.JFData.SEX) {
                this.sexName = element.DICNAME
              }
            })
            break
          case '2c478392-9c1b-40da-b941-41e4b8c9d6d3':
            this.ENUM.SFARR = newData
            this.ENUM.SFARR.forEach((element) => {
              if (element.DICID == this.JFData.XZJDCZQK) {
                this.XZJDCZQK = element.DICNAME
              }
            })
            break
          case 'db35edee-88e0-4fae-b14a-868ed4beb1d9':
            this.ENUM.NYDARR = newData
            this.ENUM.NYDARR.forEach((element) => {
              if (element.DICID == this.JFData.BUILDTYPE) {
                this.buildtype = element.DICNAME
              }
            })
            break
          case 'd2ec96d4-b5bc-404a-a9f1-34db915c694b':
            this.ENUM.JFLXARR = newData
            this.ENUM.JFLXARR.forEach((element) => {
              if (element.DICID == this.JFData.LANDTYPE) {
                this.landtype = element.DICNAME
                if (this.landtype == '农用地') {
                  this.isShow3 = true
                } else {
                  this.isShow3 = false
                  this.isShow2 = false
                }
              }
            })
            break
          case '52215e71-341a-452b-8823-a8d4aae058ab':
            this.ENUM.NYDARR = newData
            this.ENUM.NYDARR.forEach((element) => {
              if (element.DICID == this.JFData.YDLX_NYD) {
                this.YDLX_NYD = element.DICNAME
                if (this.YDLX_NYD == '其他') {
                  this.isShow2 = true
                } else {
                  this.isShow2 = false
                }
              }
            })
            break
          case 'a892e0f4-5fd6-42b4-b6c2-6e1fc5ebb5dc':
            this.ENUM.YDLXARR = newData
            this.ENUM.YDLXARR.forEach((element) => {
              if (element.DICID == this.JFData.BUILDSTOREY) {
                this.buildstorey = element.DICNAME
              }
            })
            break
          case 'f7f359ad-369c-4bf4-892c-294dceb5edef':
            this.ENUM.JGLXARR = newData
            this.ENUM.JGLXARR.forEach((element) => {
              if (element.DICID == this.JFData.SEWAGEDISPOSAL) {
                this.sewagedisposal = element.DICNAME
              }
            })
            break
          case 'b65d1943-66f4-49b1-b759-cd9f079dc0d3':
            this.ENUM.WSCLFSARR = newData
            this.ENUM.WSCLFSARR.forEach((element) => {
              if (element.DICID == this.JFData.STRUCTURETYPE) {
                this.structuretype = element.DICNAME
              }
            })
            break
          case '8670f99d-6127-45ec-be7c-8d76303bf38c':
            // this.ENUM.WSCLFSARR = newData
            this.ENUM.YHZGXARR = newData
            // this.ENUM.WSCLFSARR.forEach((element) => {
            //   if (element.DICID == this.JFData.STRUCTURETYPE) {
            //     this.structuretype = element.DICNAME
            //   }
            // })
            break
          case '173cb6af-d07c-4143-8169-8436af10264d':
            this.ENUM.HYZKARR = newData
            break
          case '67176c5f-ebad-4f7b-9cb4-d2a926f511cf':
            this.ENUM.DHLYARR = newData
            break
          case 'c3c0ecf0-2d89-4394-9f51-0fbb5de4a322':
            this.ENUM.IF_WFH_WGArr = newData
            break
          case '86d6eb80-8bcb-49f6-b5c3-462ac1ae585d':
            this.ENUM.IF_JXBLArr = newData
            break
          case 'd6aebfde-a9d7-441b-9f10-eb4c6651ea8b':
            this.ENUM.SPLXArr = newData
            break
          case 'd47fc1d9-c756-4a46-8259-7e65c82f26ba':
            this.ENUM.TKBMARR = newData
            this.ENUM.SFSJSLYJARR = newData
            this.ENUM.CJTARR = newData
            this.ENUM.IFBDCARR = newData
            this.ENUM.IFJGSYDWARR = newData
            this.ENUM.TKBMARR.forEach((element) => {
              if (element.DICID == this.JFData.ADJACENTOPINION) {
                this.adjacentopinion = element.DICNAME
                // this.F_IFSILINGYIJIAN = element.DICNAME
              }
            })
            this.ENUM.SFSJSLYJARR.forEach((item) => {
              if (item.DICID == this.JFData.F_IFSILINGYIJIAN) {
                this.F_IFSILINGYIJIAN = item.DICNAME
                if (this.F_IFSILINGYIJIAN == '是') {
                  this.isShow4 = true
                } else {
                  this.isShow4 = false
                }
              }
            })
            break
        }
      })
    },
    onConfirm18(value) {
      this.tableFrom[0].HYZK = value.DICID
      this.HYZK = value.DICNAME
      this.ENUM.HYZK = false
    },
    onConfirm14(value) {
      this.tableFrom[0].YHZGX = value.DICID
      this.YHZGX = value.DICNAME
      this.ENUM.YHZGX = false
    },
    onConfirm19(val) {
      this.showPickerq = false
      this.tableFrom[0].SWSJ = this.dateFormat(val)
    },
    onConfirm20(val) {
      this.showPickerq1 = false
      this.tableFrom[0].HHSJ = this.dateFormat(val)
    },
    onConfirm21(value) {
      this.ENUM.DHLY = false
      this.DHLY1.DHLY = value.DICID
      this.DHLY = value.DICNAME
    },
    onConfirm33(value) {
      this.JFData.IF_WFH_WG = value.DICID
      this.IF_WFH_WG = value.DICNAME
      this.ENUM.IF_WFH_WG = false
    },
    onConfirm17(value) {
      this.tableFrom[0].IFJGSYDW = value.DICID
      this.IFJGSYDW = value.DICNAME
      this.ENUM.IFJGSYDW = false
    },
    onConfirm16(value) {
      this.tableFrom[0].IFBDC = value.DICID
      this.IFBDC = value.DICNAME
      this.ENUM.IFBDC = false
    },
    onConfirm15(value) {
      this.tableFrom[0].IFCJTGD = value.DICID
      this.IFCJTGD = value.DICNAME
      this.ENUM.CJT = false
    },
    onConfirm5(value) {
      this.JFData.SEX = value.DICID
      this.tableFrom[0].SEX = value.DICID
      this.sexName = value.DICNAME
      this.FormXB = value.DICNAME
      this.ENUM.XB = false
      this.ENUM.XB1 = false
    },
    handleSelectionChange(val) {
      this.multipleSelection10 = val
    },
    saveBtn() {
      let me = this;
      let nowLine = 0
      let bitianxiang = {
        XM: '',
        SEX: '',
        SFZ: '',
        NL: '',
        YHZGX: ''
      }
      if (me.IsAddData == 'add') {
        Object.keys(me.tableFrom[0]).forEach((it) => {
          Object.keys(bitianxiang).forEach((item) => {
            if (it == item) {
              if (me.tableFrom[0][it]) {
              } else {
                console.log(it)
                nowLine += 1
              }
            }
          })
        })
        if (nowLine == 0) {
          me.zgData.forEach((item) => {
            if (item.title == '家庭成员信息') {
              if (me.dialogTitle == '新增') {
                //组织家庭成员信息
                //item.tableData.push(newObj)
                me.tableFrom[0].TO_ROW_GUID = this.mainrowGuid;
                me.tableFrom[0].TYPE = 2;
                let newObj = JSON.parse(JSON.stringify(me.tableFrom[0]))
                this.data11.push(newObj);
                let params = {
                  accessCode: '0fb3f6123d1b4fe6851c99532c463f6f',
                  cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '',
                  params: {
                    dataguid: '8d72f08a-7992-466a-81d0-b072408fea56',
                    strParams: JSON.stringify(this.data11)
                  }
                }
                FileServerProxy(params).then((res) => {
                  if (JSON.parse(res.data.data).Success) {
                    me.$toast.success('添加成功!')
                    this.getFarmInfoList();
                  } else {
                    me.$toast.fail('添加失败!')
                  }
                })
              } else {
                debugger
                this.data11.forEach((itess) => {
                  if (itess.PKID == me.tableFrom[0].PKID) {
                    let params = {
                      accessCode: '77ad6c1591e54d4fbc45ecc90374a2a2',
                      cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '',
                      params: {
                        dataguid: '8d72f08a-7992-466a-81d0-b072408fea56',
                        strParams: JSON.stringify(this.data11)
                      }
                    }
                    FileServerProxy(params).then((res) => {
                      if (JSON.parse(res.data.data).Success) {
                        me.$toast.success('修改成功!')
                        this.getFarmInfoList();
                      } else {
                        me.$toast.fail('修改失败!')
                      }
                    })
                  }
                })
                // me.tableFrom[0].TO_ROW_GUID = this.mainrowGuid;
                // me.tableFrom[0].TYPE=2;
                // let newObj = JSON.parse(JSON.stringify(me.tableFrom[0]))
                // this.data11.push(newObj);

                // item.tableData.forEach(async (it) => {
                //   if (it.ROW_GUID == me.tableFrom[0].ROW_GUID) {
                //     it = me.tableFrom[0]
                //     let params = {
                //       accessCode: '0fb3f6123d1b4fe6851c99532c463f6f',
                //       cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '',
                //       params: {
                //         dataguid: '8d72f08a-7992-466a-81d0-b072408fea56',
                //         strParams: JSON.stringify([{ PKID: it.PKID, ...it }])
                //       }
                //     }
                //     const res = await FileServerProxy(params)
                //     if (JSON.parse(res.data.data).Success) {
                //       me.$toast.success('修改成功')
                //     } else {
                //       me.$toast.fail('修改失败')
                //     }
                //   }
                // })
              }
              console.log(item.tableData)
            }
          })
          me.cancelBtn()
        } else {
          this.$toast.fail('请填写必填项!')
          this.isShow = true
        }
      } else {
        debugger

        if (nowLine == 0) {
          me.zgData.forEach((item) => {
            if (item.title == '家庭成员信息') {
              //深拷贝一层
              let newObj = JSON.parse(JSON.stringify(me.tableFrom[0]))
              if (me.dialogTitle == '新增') {
                //组织家庭成员信息
                item.tableData.push(newObj)
              } else {
                item.tableData.forEach(async (it) => {
                  if (it.ROW_GUID == me.tableFrom[0].ROW_GUID) {
                    it = me.tableFrom[0]
                    let params = {
                      accessCode: '77ad6c1591e54d4fbc45ecc90374a2a2',
                      cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '',
                      params: {
                        dataguid: '8d72f08a-7992-466a-81d0-b072408fea56',
                        strParams: JSON.stringify([{ PKID: it.PKID, ...it }])
                      }
                    }
                    const res = await FileServerProxy(params)
                    if (JSON.parse(res.data.data).Success) {
                      me.$toast.success('修改成功')
                    } else {
                      me.$toast.fail('修改失败')
                    }
                  }
                })
              }
              console.log(item.tableData)
            }
          })
          me.cancelBtn()
        } else {
          this.$toast.fail('请填写必填项!')
          this.isShow = true
        }
      }

    }
  }
}
</script>
<style scoped lang="scss">
.organizationDetails {
  position: relative;
}
</style>
